﻿using System;
using System.Collections.Generic;
using System.Text;

using GolfSigma.Inventory.Extension;

namespace GolfSigma.Inventory.Model
{
    public class BatchDeleteTeeTimesRequest : IRequest
    {
        public List<UInt64> TeeTimeIds { get; set; }

        public BatchDeleteTeeTimesRequest() { }
        public BatchDeleteTeeTimesRequest(List<UInt64> teeTimeIds)
        {
            if (teeTimeIds == null || teeTimeIds.Count < 1)
                throw new NullReferenceException("teeTimeId list null or empty");

            TeeTimeIds = teeTimeIds;
        }

        #region IRequest Members

        public string HttpVerb
        {
            get { return "POST"; }
        }

        public string HttpPath
        {
            get { return "/teetimes/batch"; }
        }

        public IDictionary<string, string> HttpParameters
        {
            get 
            {
                string prefix = "teetime.";

                // Create our post paramters
                Dictionary<string, string> result = new Dictionary<string, string>(TeeTimeIds.Count);

                // Add our id(s)
                for (int i = 0; i < TeeTimeIds.Count; i++)
                    result.Add(StringExtension.Prefix("id", prefix, i + 1), TeeTimeIds[i].ToString());

                return result;
            }
        }

        public IDictionary<string, string> HttpHeaders
        {
            get
            {
                var headers = new Dictionary<string, string>(1);
                headers.Add("x-gsws-method", "DELETE");

                return headers;
            }
        }

        #endregion
    }
}
